import React from 'react'
//定义父组件 使用class,因为有私有数据
import CmtItem from "@/components/CmtItem";

export default class CmtList extends React.Component {
    constructor() {
        super();
        this.state= {
            CommentList: [
                {id: 1, user: '张1', content: '哈哈,1'},
                {id: 2, user: '张2', content: '哈哈,2'},
                {id: 3, user: '张3', content: '哈哈,3'},
                {id: 4, user: '张4', content: '哈哈,4'},
                {id: 5, user: '张5', content: '哈哈,5'},
            ]
        }
    }
    render() {
        return <div>
            {/* 注意: 在jsx中,如果想要使用行内样式, 格式为: style={{ color: 'red'}}  */}
            <h1 style={{color:"red",fontSize:'35px',fontWeight: 200,textAlign: 'center'}}>这是评论列表组件</h1>
            {this.state.CommentList.map(item => <CmtItem {...item} key={item.id}></CmtItem>)}
        </div>

    }
}